package views.screens.nightScreens;

import java.awt.Component;
import java.awt.GridLayout;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import views.MafiaFrame;
import views.panes.ButtonUser;
import views.screens.Screen;
import views.screens.dayScreens.DayScreen;

class nightScreen5 extends JPanel implements Screen{

    public nightScreen5(boolean b, String target, final MafiaFrame mf, final nightScreen1 ns1) {
        super(new GridLayout(3,2));
        add(new Component() {});
        add(new Component() {});
        add(new ButtonUser(target, this));
        add(new JLabel(" is "+(b? "":"not ")+" a killer."));
        add(new Component() {});
        JButton next = new JButton("Next");
         next.addMouseListener(new MouseListener() {

            @Override
            public void mouseClicked(MouseEvent e) {
                if(ns1.voted.size()<mf.nrPlayers())
                    mf.update(new nightScreen1(mf, ns1.voted));
                else{
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException ex) {
                        Logger.getLogger(nightScreen5.class.getName()).log(Level.SEVERE, null, ex);
                    }
                    mf.dayScreen();
                }
            }

            @Override
            public void mousePressed(MouseEvent e) {
            }

            @Override
            public void mouseReleased(MouseEvent e) {
            }

            @Override
            public void mouseEntered(MouseEvent e) {
            }

            @Override
            public void mouseExited(MouseEvent e) {
            }
        });


        JPanel jp = new JPanel();
        jp.add(next);
        add(jp);
    }

    @Override
    public void setAction(String action) {
        
    }

}
